import { ParamsConst } from "../../../../common/global/ParamsConst";
import { CacheManager } from "../../../../../com/gengine/manager/CacheManager";
//class PetShareObject
    
    export  class PetShareObject /* flash.net.SharedObject */
    {
        

        public static save(arg1: string): void
        {
            if (PetShareObject._isCache == false) 
            {
                return;
            }
            var loc1=ParamsConst.instance.username;
            PetShareObject.getSharedObject();
            PetShareObject._userDataObj[loc1 + "_" + arg1] = true;
            PetShareObject._sharedObject.data.userDataObj = PetShareObject._userDataObj;
            return;
        }

        public static isNeedAlert(arg1: string): Boolean
        {
            var loc2=false;
            if (PetShareObject._isCache == false) 
            {
                return false;
            }
            var loc1=ParamsConst.instance.username;
            PetShareObject.getSharedObject();
            if (PetShareObject._userDataObj[loc1 + "_" + arg1]) 
            {
                loc2 = PetShareObject._userDataObj[loc1 + "_" + arg1] as Boolean;
                if (loc2) 
                {
                    return false;
                }
            }
            return true;
        }

        /* internal  */static getSharedObject(): void
        {
            if (PetShareObject._sharedObject == null) 
            {
                PetShareObject._sharedObject = CacheManager.instance.getLocal(PetShareObject.PetKey);
                PetShareObject._sharedObject.addEventListener(flash.events.NetStatusEvent.NET_STATUS, PetShareObject.onNetStatusEvent);
            }
            if (PetShareObject._userDataObj == null) 
            {
                PetShareObject._userDataObj = PetShareObject._sharedObject.data.userDataObj;
                if (PetShareObject._userDataObj == null) 
                {
                    PetShareObject._userDataObj = {};
                }
            }
            return;
        }

        /* internal  */static onNetStatusEvent(arg1: Object /* flash.events.NetStatusEvent */): void
        {
            if (arg1.info.code != "SharedObject.Flush.Failed") 
            {
                PetShareObject._isCache = true;
            }
            else 
            {
                PetShareObject._isCache = false;
            }
            return;
        }

        /* internal */ static /* const */PetKey: string="Pet_Key";

        public static /* const */GrowthKey: string="GrowthAlert";

        public static /* const */SpiritKey: string="SpiritAlert";

        public static /* const */ChangeModelKey: string="ChangeModelAlert";

        /* internal */ static /* var */_userDataObj: Object;

        /* internal */ static /* var */_sharedObject: Object /* flash.net.SharedObject */;

        /* internal */ static /* var */_isCache: Boolean=true;
    }

            PetShareObject._isCache = true;
        